#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
struct where{
    size_t line;
    size_t column;
};
map<string, vector<where>> words;
void input() {
    string line;
    size_t num = 0;
    while (1) {
        getline(cin, line);
        num++;
        if (line.empty()) {
            string next;
            getline(cin, next);
            if(next.empty()) break;
            line = next;
            num++;
        }
        istringstream iss(line);
        string word;
        size_t column = 1;
        while (iss >> word) {
            for (char &c : word) {
                if(c > 127) c = '?';
            }
            words[word].push_back({num, column});
            column += word.length() + 1;
        }
    }
}
void search(const string& word) {
    auto find = words.find(word);
    if (find != words.end()) {
        for (const auto& p : find->second) {
            cout << "'" << word << "' occurs at Line " << p.line
                 << " Column " << p.column << "." << endl;
        }
    } else {
        cout << "'" << word << "' does not occur." << endl;
    }
}
int main(){
    input();
    string word;
    while (getline(cin, word)) {
        search(word);
    }
}
